/**
 * projectName: mbzwb-parent
 * fileName: EnvironmentUtil.java
 * packageName: com.palmdoctor.mb.base.util
 * date: 2021-06-15 16:19
 * copyright(c) 2021 http://www.hydee.cn/ Inc. All rights reserved.
 */
package com.zny.sescore.util;

import cn.hutool.extra.spring.SpringUtil;
import org.springframework.core.env.Environment;

import java.util.Objects;

/**
 * @version: V1.0
 * @author: zhangnayi
 * @className: EnvironmentUtil
 * @packageName: com.palmdoctor.mb.base.util
 * @description:
 * @data: 2021-06-15 16:19
 **/
public class EnvironmentUtil {

    public static String getActiveProfiles() {
        String[] profiles = SpringUtil.getBean(Environment.class).getActiveProfiles();
        if (profiles.length > 0) {
            return profiles[0];
        }
        return "default";
    }

    public static boolean isDevMode() {
        return Objects.equals(getActiveProfiles(), "dev");
    }

    public static boolean isTestMode() {
        return Objects.equals(getActiveProfiles(), "test");
    }


    public static boolean notProMode() {
        return !Objects.equals(getActiveProfiles(), "pro");
    }
}